import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: '首页',
    component: () => import('../views/index/Index.vue'),
    meta:{
      alive:true
    }
  },
  {
    path: '/personal',
    name: 'personal',
    component: () => import('../views/index/Personnal.vue'),
    meta:{
      alive:true
    },
    // 重定向:
    // 当直接访问/components时 自动跳转到该路径
    // redirect: '/components/container', 
    children: [{
      path: 'myorder',
      component: () => import('../views/personal/MyOrder.vue')
    },{
      path: 'mymessage',
      component: () => import('../views/personal/MyMessage.vue')
    },{
      path: 'mywuliu',
      component: () => import('../views/personal/MyWuliu.vue')
    },
    {
      path: 'myaddress',
      component: () => import('../views/personal/MyAddress')
    },]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
